
from inout.data import ParseTeacherInfoFile
"""
@parameter:
    total: 该门课总课时数
    scheded: 已规划课时数
"""
class CourseMdl(object):
    def __init__(self, course_name, total, week_start, week_end, locations=[]):
        self.course_name = course_name
        self.total = total
        self.week = (week_start, week_end)
        self.scheded = 0
        self.locations = locations

    def Compatible_All_Locations(self):
        return self.locations == []
    
    def In_Locations(self, location):
        return location in self.locations



class KlassMdl(object):
    def __init__(self, klass_name):
        self.klass_name = klass_name
        

"""
@parameter:
    courses: 当前教师的课程数量
"""
class TeacherMdl(object):
    def __init__(self, teacher_id, teacher_name, priority, rules = None):
        self.id = teacher_id
        self.name = teacher_name
        self.priority = priority
        # self.courses = courses
        self.rules = rules  # 不支持对某一门课程的规则

    def UpdateRules(self, new_rules):
        self.rules = new_rules

    def UpdatePriority(self, priority):
        self.priority = priority

class TCKMdl(object):
    def __init__(self, teacher_mdl=None, course_mdl=None, klass_mdl=None):
        self.tm = teacher_mdl
        self.cm = course_mdl
        self.km = klass_mdl

    def Get_Tm(self):
        return self.tm
    
    def Get_Cm(self):
        return self.cm


class TCMHandler(object):
    def __init__(self, raw_tck_content):
        self.teacher_id_2_name = ParseTeacherInfoFile()


DEFAULT_TCM = TCKMdl()
